<?php

Raise::load('core.RaiseObject');
Raise::load('db.core.RaiseDbModel');

/**
 * RaiseDbRelationship class
 * Defines a model's relationship with another 
 *
 * @author Sam Yong
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package phpraise.db.core
 * @since 1.2
 */
class RaiseDbRelationship extends RaiseObject {
    
    /**
     * The model that this relationship applies to
     * @var RaiseDbModel
     */
    private $thisModel;

    /**
     * The condition for this relationship
     * @var RaiseDbSqlWhere
     */
    private $condition;
    
    /**
     * Get or set the model that this relationship applies to
     * @param RaiseDbModel $t (optional) Set the model that this relationship applies to
     * @return RaiseDbModel
     */
    public function thisModel($t = null){
        if(func_num_args() == 1){
            $this->thisModel = $t;
        }
        return $this->thisModel;
    }

    /**
     * Get or set the condition(s) for this relationship
     * @param RaiseDbSqlWhere $c (optional) New condition
     * @return RaiseDbSqlWhere
     */
    public function condition($c = null){
        if(func_num_args() == 1){
            $this->condition = $c;
        }
        return $this->condition;
    }
    
}
